﻿<?xml version="1.0" encoding="utf-8" ?>
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2" 
                   assembly="WebPattern.Core" 
                   namespace="WebPattern.Core">
  
  <class name="User" table="`Users`">

    <id name="Id" column="UserId" unsaved-value="0">
      <generator class="native" />
    </id>

    
    
    <natural-id mutable="false">
      <property name="UserName" unique="true" />
    </natural-id>
    
    <timestamp name="UpdatedAt" column="UpdatedAt" />
    <property name="ApplicationName" update="false" />
    <property name="CreatedAt" update="false" />
    <property name="Name" />
    <property name="Email" />
    <property name="MobilePhone" />
    <property name="UserType" />
    <property name="Password" column="`Password`" />
    <property name="PasswordQuestion" />
    <property name="PasswordAnswer" />
    <property name="LastPasswordChangedDate" />
    <property name="IsApproved" />
    <property name="IsLockedOut" />
    <property name="IsOnline" />
    <property name="FailedPasswordAttemptCount" />
    <property name="FailedPasswordAttemptWindowStart" />
    <property name="FailedPasswordAnswerAttemptCount" />
    <property name="FailedPasswordAnswerAttemptWindowStart" />
    <property name="LastLoginDate" />
    <property name="LastActivityDate" />
    <property name="LastLockoutDate" />
    <property name="LastLogOutDate" />
    <property name="PrevLoginDate"/>
    <property name="Comment"/>
    <property name="Enabled" column="`Enabled`"/>

    <set name="UserRoles" table="Security_UsersInRoles" lazy="false" fetch="subselect" outer-join="false">
      <key column="UserId" not-null="true" unique="true" />
      <many-to-many column="RoleId" class="Role" lazy="false" fetch="join"/>
    </set>
  </class>
</hibernate-mapping>